package edu.nf.utils;

public class SQLExecutorContext {

    private static ThreadLocal<SQLExecutor> local;

    /**
     * 获取当前线程的SQLExcector
     * @return
     */
    public static SQLExecutor currentSQLExcector(){
        if(local.get() == null){
            local.set(new SQLExecutor(DBUtil.getConnection()));
        }

        return local.get();
    }

    /**
     * 移除当前线程的SQLExecutor
     */
    public void close(){
        local.remove();
    }

}
